<!DOCTYPE html>


<html lang="en">
  

    <head>
      <meta charset="utf-8" />
        
      <meta
        name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1"
      />
      <title>GBase8sjdbc连接串相关 |  朝花夕拾</title>
  <meta name="generator" content="hexo-theme-ayer">
      
      <link rel="shortcut icon" href="/ww.ico" />
       
<link rel="stylesheet" href="/dist/main.css">

      
<link rel="stylesheet" href="/css/fonts/remixicon.css">

      
<link rel="stylesheet" href="/css/custom.css">
 
      <script src="https://cdn.staticfile.org/pace/1.2.4/pace.min.js"></script>
       
 

      <link
        rel="stylesheet"
        href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-bulma@5.0.1/bulma.min.css"
      />
      <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.19/dist/sweetalert2.min.js"></script>

      <!-- mermaid -->
      
      <style>
        .swal2-styled.swal2-confirm {
          font-size: 1.6rem;
        }
      </style>
    </head>
  </html>
</html>


<body>
  <div id="app">
    
      
    <main class="content on">
      <section class="outer">
  <article
  id="post-GBase8sjdbc连接串相关"
  class="article article-type-post"
  itemscope
  itemprop="blogPost"
  data-scroll-reveal
>
  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  GBase8sjdbc连接串相关
</h1>
 

      
    </header>
     
    <div class="article-meta">
      <a href="/2023/05/10/GBase8sjdbc%E8%BF%9E%E6%8E%A5%E4%B8%B2%E7%9B%B8%E5%85%B3/" class="article-date">
  <time datetime="2023-05-10T01:31:15.000Z" itemprop="datePublished">2023-05-10</time>
</a> 
  <div class="article-category">
    <a class="article-category-link" href="/categories/GBase8s/">GBase8s</a>
  </div>
  
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> Word count:</span>
            <span class="post-count">2.7k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> Reading time≈</span>
            <span class="post-count">13 min</span>
        </span>
    </span>
</div>
 
    </div>
      
    <div class="tocbot"></div>




  
    <div class="article-entry" itemprop="articleBody">
       
  <h5 id="HDR环境，通过SQLH-FILE连接db-group"><a href="#HDR环境，通过SQLH-FILE连接db-group" class="headerlink" title="HDR环境，通过SQLH_FILE连接db_group"></a>HDR环境，通过SQLH_FILE连接db_group</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">db_group        group   -       -       i=1</span><br><span class="line">g300     onsoctcp 1.1.1.2 9082 g=db_group</span><br><span class="line">g300_hdr onsoctcp 1.1.1.3 9082 g=db_group</span><br></pre></td></tr></table></figure>

<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jdbc:gbasedbt-sqli:/testdb:GBASEDBTSERVER=db_group;SQLH_TYPE=FILE;SQLH_FILE=D:\soft\jdbc\sqlhosts.text.txt;SQLMODE=GBase;file=D:\soft\jdbc\sqlhosts.text.txt;DB_LOCALE=zh_CN.57372;CLIENT_LOCALE=zh_CN.utf8;LOGINTIMEOUT=200;IFX_LOCK_MODE_WAIT=60;APPENDISAM=true;UPPER_CASE=y</span><br></pre></td></tr></table></figure>

<ul>
<li><h6 id="测试结果：（测试环境注明：ServerBuildNumber-3-0-0-93e040，-DRAUTO-x3D-0-，-JdbcDriver：3-3-0-2-）"><a href="#测试结果：（测试环境注明：ServerBuildNumber-3-0-0-93e040，-DRAUTO-x3D-0-，-JdbcDriver：3-3-0-2-）" class="headerlink" title="测试结果：（测试环境注明：ServerBuildNumber: 3.0.0_93e040， DRAUTO&#x3D;0 ， JdbcDriver：3.3.0_2 ）"></a>测试结果：（测试环境注明：ServerBuildNumber: 3.0.0_93e040， DRAUTO&#x3D;0 ， JdbcDriver：3.3.0_2 ）</h6></li>
</ul>
<ol>
<li><p>APP只会连接到组中的主节点，不会连接到备节点。</p>
</li>
<li><p>如果主节点宕机了，APP就会报错并且连接不上备节点。</p>
</li>
<li><p>如果主节点宕机了，备节点人为调整为standard模式，APP可以连接上来。</p>
</li>
<li><p>如果主节点宕机了，备节点人为调整为standard模式，此时再启动主节点数据库会收到报错，并不会出现双主。此时只要要PHY启动并加会集群即可。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">应用程序端收到的报错：</span></span><br><span class="line">Product: DbVisualizer Pro 10.0.20 [Build #2901]</span><br><span class="line">OS: Windows 10</span><br><span class="line">OS Version: 10.0</span><br><span class="line">OS Arch: amd64</span><br><span class="line">Java Version: 1.8.0_202</span><br><span class="line">Java VM: Java HotSpot(TM) 64-Bit Server VM</span><br><span class="line">Java Vendor: Oracle Corporation</span><br><span class="line">Java Home: d:\install\dbvisualizer\jre</span><br><span class="line">DbVis Home: D:\install\DbVisualizer</span><br><span class="line">User Home: C:\Users\Lenovo</span><br><span class="line">PrefsDir: C:\Users\Lenovo\.dbvis</span><br><span class="line">SessionId: 162</span><br><span class="line">BindDir: C:\Users\Lenovo\.dbvis\[0]</span><br><span class="line"></span><br><span class="line">An error occurred while establishing the connection:</span><br><span class="line"></span><br><span class="line">Long Message:</span><br><span class="line">None of the server in group is in primary or standard mode.</span><br><span class="line"></span><br><span class="line">Details:</span><br><span class="line">???Type: java.sql.SQLException</span><br><span class="line">???Error Code: -27009</span><br><span class="line">???SQL State: IX000</span><br><span class="line"></span><br></pre></td></tr></table></figure></li>
</ol>
<p><strong>小结：通过SQLH_FILE连接db_group，程序只会连接到组中的主节点或标准节点，不会连接到备节点。</strong></p>
<h5 id="HDR环境，通过ENABLE-HDRSWITCH连接HDR集群"><a href="#HDR环境，通过ENABLE-HDRSWITCH连接HDR集群" class="headerlink" title="HDR环境，通过ENABLE_HDRSWITCH连接HDR集群"></a>HDR环境，通过ENABLE_HDRSWITCH连接HDR集群</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">db_group        group   -       -       i=1</span><br><span class="line">g300     onsoctcp 1.1.1.2 9082 g=db_group</span><br><span class="line">g300_hdr onsoctcp 1.1.1.3 9082 g=db_group</span><br></pre></td></tr></table></figure>

<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jdbc:gbasedbt-sqli://1.1.1.2:9082/testdb:GBASEDBTSERVER=g300;ENABLE_HDRSWITCH=true;IFXHOST=1.1.1.2;PORTNO=9082;GBASEDBTSERVER_SECONDARY=g300_hdr;IFXHOST_SECONDARY=1.1.1.3;PORTNO_SECONDARY=9082;DB_LOCALE=zh_CN.utf8;CLIENT_LOCALE=zh_CN.utf8;LOGINTIMEOUT=200;IFX_LOCK_MODE_WAIT=60;APPENDISAM=true;UPPER_CASE=y</span><br></pre></td></tr></table></figure>

<ul>
<li><h6 id="测试结果：（测试环境注明：ServerBuildNumber-3-0-0-93e040，-DRAUTO-x3D-0-，-JdbcDriver：3-3-0-2-）-1"><a href="#测试结果：（测试环境注明：ServerBuildNumber-3-0-0-93e040，-DRAUTO-x3D-0-，-JdbcDriver：3-3-0-2-）-1" class="headerlink" title="测试结果：（测试环境注明：ServerBuildNumber: 3.0.0_93e040， DRAUTO&#x3D;0 ， JdbcDriver：3.3.0_2 ）"></a>测试结果：（测试环境注明：ServerBuildNumber: 3.0.0_93e040， DRAUTO&#x3D;0 ， JdbcDriver：3.3.0_2 ）</h6></li>
</ul>
<ol>
<li>使用上述 URL 连接 HDR 服务器对，当参数 GBASEDBTSERVER指定的主服务器正常运行时，应用程序被连接到服务器上，当主服务器发生错误时，应用程序会连接到 GBASEDBTSERVER_SECONDARY指定的务器上。</li>
<li>这种写法不会真的考虑谁是主谁是备。</li>
<li>这种写法只是给APP提供了两个连接地址，APP先找GBASEDBTSERVER，如果不通再找GBASEDBTSERVER_SECONDARY。</li>
<li>这种写法需要配合DRAUTO&#x3D;1使用，即：保留GBASEDBTSERVER指定的节点为主节点。</li>
</ol>
<p><strong>小结：ENABLE_HDRSWITCH连接HDR集群，程序会顺序连接。</strong></p>
<h5 id="扩展：普通的单点连接字符串："><a href="#扩展：普通的单点连接字符串：" class="headerlink" title="扩展：普通的单点连接字符串："></a>扩展：普通的单点连接字符串：</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jdbc:gbasedbt-sqli://1.1.1.2:9082/testdb:GBASEDBTSERVER=g300;CLIENT_LOCALE=zh_cn.utf8;DB_LOCALE=zh_cn.utf8;LOGINTIMEOUT=200;IFX_LOCK_MODE_WAIT=60;APPENDISAM=true;UPPER_CASE=y;DBDATE=Y4MD</span><br></pre></td></tr></table></figure>



<h5 id="扩展结论1：DRAOUTO参数设置为0-的时候如果主备之间的网络没有断开，并不会出现双主，后启动的主节点会自动宕机。"><a href="#扩展结论1：DRAOUTO参数设置为0-的时候如果主备之间的网络没有断开，并不会出现双主，后启动的主节点会自动宕机。" class="headerlink" title="扩展结论1：DRAOUTO参数设置为0 的时候如果主备之间的网络没有断开，并不会出现双主，后启动的主节点会自动宕机。"></a>扩展结论1：DRAOUTO参数设置为0 的时候如果主备之间的网络没有断开，并不会出现双主，后启动的主节点会自动宕机。</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">数据库端收到的报错：</span></span><br><span class="line">[gbasedbt@wei3 ~]$ onstat -m</span><br><span class="line">shared memory not initialized for GBASEDBTSERVER &#x27;g300_hdr&#x27;</span><br><span class="line"></span><br><span class="line">Message Log File: /opt/install/g300/tmp/online.log</span><br><span class="line">16:26:26  Started 1 B-tree scanners.</span><br><span class="line">16:26:26  B-tree scanner threshold set at 5000.</span><br><span class="line">16:26:26  B-tree scanner range scan size set to -1.</span><br><span class="line">16:26:26  B-tree scanner ALICE mode set to 6.</span><br><span class="line">16:26:26  B-tree scanner index compression level set to med.</span><br><span class="line">16:26:26  DR: Reservation of the last logical log for log backup turned on</span><br><span class="line">16:26:26  DR: Trying to connect to secondary server = g300</span><br><span class="line">16:26:27  DR: Turned off on primary server</span><br><span class="line">16:26:27  DR: Local and Remote server type and/or last change(LC) incompatible</span><br><span class="line">              [Local  type: Primary,    LC: Primary mode]</span><br><span class="line">              [Remote type: Standard,   LC: ]</span><br><span class="line"></span><br><span class="line">16:26:27  DR: Cannot start the Primary server when the paired server is of</span><br><span class="line">              incompatible (Primary or Standard) type. Please convert</span><br><span class="line">              the paired server to compatible (Secondary) type.</span><br><span class="line">16:26:27  oninit: Fatal error in shared memory initialization</span><br><span class="line"></span><br><span class="line">16:26:27  GBase Database Server Stopped.</span><br><span class="line"></span><br><span class="line">16:26:27  mt_shm_remove: WARNING: may not have removed all/correct segments</span><br><span class="line">[gbasedbt@wei3 ~]$ </span><br></pre></td></tr></table></figure>

<h5 id="扩展结论2：DRAOUTO参数设置为1-x2F-2的时候，如果主备都宕机了，此时单独先启动备，备起来后还是备并不会出现多主。"><a href="#扩展结论2：DRAOUTO参数设置为1-x2F-2的时候，如果主备都宕机了，此时单独先启动备，备起来后还是备并不会出现多主。" class="headerlink" title="扩展结论2：DRAOUTO参数设置为1&#x2F;2的时候，如果主备都宕机了，此时单独先启动备，备起来后还是备并不会出现多主。"></a>扩展结论2：DRAOUTO参数设置为1&#x2F;2的时候，如果主备都宕机了，此时单独先启动备，备起来后还是备并不会出现多主。</h5><h5 id="扩展结论3：DRAOUTO参数设置为1-x2F-2的时候，如果主备都宕机了，此时同时启动主和备，起来后角色不会变，只是HDR状态是off，需要再次onmode-secondary一下。"><a href="#扩展结论3：DRAOUTO参数设置为1-x2F-2的时候，如果主备都宕机了，此时同时启动主和备，起来后角色不会变，只是HDR状态是off，需要再次onmode-secondary一下。" class="headerlink" title="扩展结论3：DRAOUTO参数设置为1&#x2F;2的时候，如果主备都宕机了，此时同时启动主和备，起来后角色不会变，只是HDR状态是off，需要再次onmode-secondary一下。"></a>扩展结论3：DRAOUTO参数设置为1&#x2F;2的时候，如果主备都宕机了，此时同时启动主和备，起来后角色不会变，只是HDR状态是off，需要再次onmode-secondary一下。</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">nohup oninit -vy &amp;</span><br><span class="line">ssh wei3 &quot;. /home/gbasedbt/.bash_profile; oninit -vy &amp;&quot;</span><br><span class="line">sleep 60;</span><br><span class="line">onmode -d secondary g300_hdr</span><br></pre></td></tr></table></figure>



<h5 id="扩展推论1：关于双主的出现"><a href="#扩展推论1：关于双主的出现" class="headerlink" title="扩展推论1：关于双主的出现"></a>扩展推论1：关于双主的出现</h5><ul>
<li>出现双主的主要原因是主备之间的网络不通。</li>
<li>如果网络是通的，DRAUTO参数为1&#x2F;2的情况下不会出现双主，除非人工干预改变了一些值。</li>
<li>DRAUTO参数为0的情况下，就是纯人工维护集群关系，人不犯傻就不会出现双主。</li>
</ul>
<h5 id="扩展推论2：关于双主的预防"><a href="#扩展推论2：关于双主的预防" class="headerlink" title="扩展推论2：关于双主的预防"></a>扩展推论2：关于双主的预防</h5><ul>
<li>如果主备之间的网络断开了，就会出现双主。</li>
<li>如果主备之间是同一个网关，那么主备之间的网络不通，就是主到网关不通或者备到网关不通，此时我们只要是检测到谁到网关不通就自杀，就不会出现双主问题。（此时不用考虑网关故障，如果网关故障我们把两个数据库都关闭了也正常）。</li>
</ul>
<h5 id="扩展推论2：万一出现双主的处理"><a href="#扩展推论2：万一出现双主的处理" class="headerlink" title="扩展推论2：万一出现双主的处理"></a>扩展推论2：万一出现双主的处理</h5><ul>
<li>如果已经双主了，那么通过SQLH_FILE连接db_group的连接方式会连接到组里面的多个实例。group好像可以控制先连接第一个实例，连接不上再连接第二个实例。</li>
<li>如果已经双主了，通过ENABLE_HDRSWITCH连接HDR集群的连接方法会优先连接GBASEDBTSERVER。</li>
<li>如果已经双主了，就会有数据写错地方的风险。</li>
</ul>
<h5 id="扩展推论3：需要两个程序"><a href="#扩展推论3：需要两个程序" class="headerlink" title="扩展推论3：需要两个程序"></a>扩展推论3：需要两个程序</h5><ul>
<li><p>其一，ping不通网关自杀。</p>
</li>
<li><p>其二，检测当前是不是双主，如果是，杀掉日志较少的实例。</p>
</li>
</ul>
<h5 id="扩展推论4：回过头来想想想双主这个事"><a href="#扩展推论4：回过头来想想想双主这个事" class="headerlink" title="扩展推论4：回过头来想想想双主这个事"></a>扩展推论4：回过头来想想想双主这个事</h5><ul>
<li><p>双主的出现只会是这两个原因导致的：主备间的网络断开  或   人工犯傻</p>
</li>
<li><p>人工犯傻我们不考虑。</p>
</li>
<li><p>主备间的网络断开，如果集群配置和APP应用，用的是通一个服务名，那么就是说主备断开的时候必然有一个节点的APP连接网络也是断开的，也就是说这个节点这时候是接收不到APP数据的。那么此时即使双主，也不会有数据写入到这个节点，此时我们只要把这个端口不通的实例关闭掉数据就安全了。等网络恢复后再把这个关闭的实例也备机的身份加入集群即可。</p>
</li>
</ul>
<h3 id="后来测试发现"><a href="#后来测试发现" class="headerlink" title="后来测试发现"></a>后来测试发现</h3><h6 id="发现：-主备间的网络断开了，备机自动会变成主，当主备的网络恢复后，主机再找到备机的时候，主会自杀以保护集群数据安全。"><a href="#发现：-主备间的网络断开了，备机自动会变成主，当主备的网络恢复后，主机再找到备机的时候，主会自杀以保护集群数据安全。" class="headerlink" title="发现： 主备间的网络断开了，备机自动会变成主，当主备的网络恢复后，主机再找到备机的时候，主会自杀以保护集群数据安全。"></a>发现： 主备间的网络断开了，备机自动会变成主，当主备的网络恢复后，主机再找到备机的时候，主会自杀以保护集群数据安全。</h6><p><strong>当时的原主机日志如下：</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line">14:56:13  Checkpoint Completed:  duration was 26 seconds.</span><br><span class="line">14:56:13  Fri Dec  2 - loguniq 9, logpos 0x8295018, timestamp: 0x1463a3 Interval: 328</span><br><span class="line"></span><br><span class="line">14:56:13  Maximum server connections 200</span><br><span class="line">14:56:13  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 4, Llog used 2</span><br><span class="line"></span><br><span class="line">14:59:01  DR: Receive error</span><br><span class="line">14:59:02  dr_prsend thread : asfcode = -25582: oserr = 0: errstr = : Network connection is broken.</span><br><span class="line"></span><br><span class="line">14:59:02  DR_ERR set to -1</span><br><span class="line">14:59:02  SMX thread is exiting</span><br><span class="line">14:59:04  DR: Turned off on primary server</span><br><span class="line">14:59:04  DR: Cannot connect to secondary server</span><br><span class="line">14:59:04  Process exited with return code 126: /bin/sh /bin/sh -c /opt/install/g300/etc/alarmprogram.sh 3 15 &quot;Data Replication failure.&quot; &quot;DR: Turned off on </span><br><span class="line">primary server&quot; &quot;&quot; 15002</span><br><span class="line">14:59:04  Process exited with return code 126: /bin/sh /bin/sh -c /opt/install/g300/etc/alarmprogram.sh 3 15 &quot;Data Replication failure.&quot; &quot;DR: Cannot connect to secondary server&quot; &quot;&quot; 15003</span><br><span class="line">14:59:17  DR: Primary server detected peer is now primary or standard.</span><br><span class="line">              Use oninit to restart this server as HDR secondary.</span><br><span class="line">14:59:17  DR:Shutting down the server.</span><br><span class="line">14:59:17  DR:Terminating the master daemon to bring system down immediately.</span><br><span class="line">14:59:19  The Master Daemon Died</span><br><span class="line">14:59:19  The Master Daemon Died</span><br><span class="line">14:59:19  The Master Daemon Died</span><br><span class="line">14:59:19  invoke_alarm(): /bin/sh -c &#x27;/opt/install/g300/etc/alarmprogram.sh 5 6 &quot;Internal Subsystem failure: &#x27;MT&#x27;&quot; &quot;The Master Daemon Died&quot; &quot;&quot; 6069&#x27;</span><br><span class="line">14:59:19  invoke_alarm(): /bin/sh -c &#x27;/opt/install/g300/etc/alarmprogram.sh 5 6 &quot;Internal Subsystem failure: &#x27;MT&#x27;&quot; &quot;The Master Daemon Died&quot; &quot;&quot; 6069&#x27;</span><br><span class="line">14:59:19  invoke_alarm(): /bin/sh -c &#x27;/opt/install/g300/etc/alarmprogram.sh 5 6 &quot;Internal Subsystem failure: &#x27;MT&#x27;&quot; &quot;The Master Daemon Died&quot; &quot;&quot; 6069&#x27;</span><br><span class="line">14:59:19  invoke_alarm(): mt_exec failed, status 32256, errno 0</span><br><span class="line">14:59:19  invoke_alarm(): mt_exec failed, status 32256, errno 0</span><br><span class="line">14:59:19  invoke_alarm(): mt_exec failed, status 32256, errno 0</span><br><span class="line">14:59:19  PANIC: Attempting to bring system down</span><br><span class="line">~                                                                                                                                                           </span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p><strong>当时的新主机日志如下：</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br></pre></td><td class="code"><pre><span class="line">14:40:46  Maximum server connections 1 </span><br><span class="line">14:40:46  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 4, Llog used 0</span><br><span class="line"></span><br><span class="line">14:56:14  Checkpoint Completed:  duration was 0 seconds.</span><br><span class="line">14:56:14  Fri Dec  2 - loguniq 9, logpos 0x8295018, timestamp: 0x146498 Interval: 333</span><br><span class="line"></span><br><span class="line">14:56:14  Maximum server connections 1 </span><br><span class="line">14:56:14  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 4, Llog used 0</span><br><span class="line"></span><br><span class="line">14:57:49  The SMX connection between high availability servers was closed because the</span><br><span class="line"> peer server was unresponsive for the timeout period (60 seconds times the</span><br><span class="line"> number of retries). </span><br><span class="line">14:58:39  DR: ping timeout</span><br><span class="line">14:58:39  DR: Receive error</span><br><span class="line">14:58:39  dr_secrcv thread : asfcode = -25582: oserr = 4: errstr = : Network connection is broken.</span><br><span class="line"> System error = 4.</span><br><span class="line">14:58:39  DR_ERR set to -1</span><br><span class="line">14:58:40  DR: Turned off on secondary server</span><br><span class="line">14:58:40  Skipping failover callback.</span><br><span class="line">14:58:41  Process exited with return code 126: /bin/sh /bin/sh -c /opt/install/g300/etc/alarmprogram.sh 3 15 &quot;Data Replication failure.&quot; &quot;DR: Turned off on secondary server&quot; &quot;&quot; 15001</span><br><span class="line">14:58:41  Logical Recovery has reached the transaction cleanup phase.</span><br><span class="line">14:58:42  Checkpoint Completed:  duration was 0 seconds.</span><br><span class="line">14:58:42  Fri Dec  2 - loguniq 9, logpos 0x8297018, timestamp: 0x1464a6 Interval: 334</span><br><span class="line"></span><br><span class="line">14:58:42  Maximum server connections 1 </span><br><span class="line">14:58:42  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 0, Llog used 1</span><br><span class="line"></span><br><span class="line">14:58:42  Logical Recovery Complete.</span><br><span class="line">          648 Committed, 0 Rolled Back, 0 Open, 0 Bad Locks</span><br><span class="line"></span><br><span class="line">14:58:42  Logical Recovery Complete.</span><br><span class="line">14:58:42  Quiescent Mode</span><br><span class="line">14:58:42  Checkpoint Completed:  duration was 0 seconds.</span><br><span class="line">14:58:42  Fri Dec  2 - loguniq 9, logpos 0x8299018, timestamp: 0x146591 Interval: 335</span><br><span class="line"></span><br><span class="line">14:58:42  Maximum server connections 1 </span><br><span class="line">14:58:42  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 7, Llog used 2</span><br><span class="line"></span><br><span class="line">14:58:42  On-Line Mode</span><br><span class="line">14:58:42  Defragmenter cleaner thread now running</span><br><span class="line">14:58:42  Defragmenter cleaner thread cleaned:0 partitions</span><br><span class="line">14:58:43  SCHAPI: &quot;GBASEDBTDIR/etc/sysadmin/stop&quot; file is present.</span><br><span class="line">          Bypassing dbScheduler and dbWorker threads startup.</span><br><span class="line">14:58:43  B-tree scanners enabled.</span><br><span class="line">14:58:43  DR: Reservation of the last logical log for log backup turned on</span><br><span class="line">14:58:43  SCHAPI: &quot;GBASEDBTDIR/etc/sysadmin/stop&quot; file is present.</span><br><span class="line">          Bypassing dbScheduler and dbWorker threads startup.</span><br><span class="line">14:58:44  DR: new type = standard</span><br><span class="line">14:59:15  DR: Secondary server connected</span><br><span class="line">14:59:17  DR: Receive error</span><br><span class="line">14:59:17  dr_secrcv thread : asfcode = -25582: oserr = 0: errstr = : Network connection is broken.</span><br><span class="line"></span><br><span class="line">14:59:17  DR_ERR set to -1</span><br><span class="line">14:59:17  DR: Failure recovery error (2)</span><br><span class="line">14:59:17  DR: Log Record Apply Thread Exited.</span><br><span class="line">14:59:17  DR: Turned off on secondary server</span><br><span class="line">14:59:17  Process exited with return code 126: /bin/sh /bin/sh -c /opt/install/g300/etc/alarmprogram.sh 3 15 &quot;Data Replication failure.&quot; &quot;DR: Turned off on secondary server&quot; &quot;&quot; 15001</span><br><span class="line">14:59:17  DR: Standard to Standard</span><br><span class="line">14:59:17  SCHAPI: &quot;GBASEDBTDIR/etc/sysadmin/stop&quot; file is present.</span><br><span class="line">          Bypassing dbScheduler and dbWorker threads startup.</span><br><span class="line">14:59:17  DR: new type = standard</span><br><span class="line">15:04:02  Checkpoint Completed:  duration was 0 seconds.</span><br><span class="line">15:04:02  Fri Dec  2 - loguniq 9, logpos 0x829c018, timestamp: 0x1465a8 Interval: 336</span><br><span class="line"></span><br><span class="line">15:04:02  Maximum server connections 1 </span><br></pre></td></tr></table></figure>



<h3 id="最终结论"><a href="#最终结论" class="headerlink" title="最终结论"></a>最终结论</h3><ol>
<li><p>db_group的特点</p>
<ul>
<li>db_group只会找主或标准实例，绝对不会找备(SDS或HDR或RSS).</li>
<li>如果db_group在组里面有多主的时候，只连接第1个，第1个不通再连第2个。</li>
<li>db_group只可以解决连接问题，切换问题还需要配合DRAUTO来实现。</li>
</ul>
</li>
<li><p>cm的特点</p>
<ul>
<li><p>cm应该放在第3个节点上，这样它知道具体是哪个节点断网了。</p>
</li>
<li><p>cm放在和备节点一起的毛病是，备机掉网了，备数据库会变成主（因为cm到备库是通的，同时到主库是不通的）。</p>
</li>
</ul>
</li>
</ol>
 
      <!-- reward -->
      
    </div>
    

    <!-- copyright -->
    
    <div class="declare">
      <ul class="post-copyright">
        <li>
          <i class="ri-copyright-line"></i>
          <strong>Copyright： </strong>
          
          Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
          
        </li>
      </ul>
    </div>
    
    <footer class="article-footer">
       
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=http://example.com/2023/05/10/GBase8sjdbc%E8%BF%9E%E6%8E%A5%E4%B8%B2%E7%9B%B8%E5%85%B3/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>  
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/jdbc/" rel="tag">jdbc</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%BF%9E%E6%8E%A5%E4%B8%B2/" rel="tag">连接串</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E9%AB%98%E5%8F%AF%E7%94%A8/" rel="tag">高可用</a></li></ul>

    </footer>
  </div>

   
  <nav class="article-nav">
    
      <a href="/2023/05/10/GBase8sDruid%E6%B5%8B%E8%AF%95%E7%94%A8%E4%BE%8B/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            GBase8sDruid测试用例
          
        </div>
      </a>
    
    
      <a href="/2023/05/10/GBase8s%E5%85%B3%E4%BA%8EDBSpaces%E8%87%AA%E5%8A%A8%E6%89%A9%E5%AE%B9%E7%9A%84%E6%B5%8B%E8%AF%95/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">GBase8s关于DBSpaces自动扩容的测试</div>
      </a>
    
  </nav>

  
   
  
    
</article>

</section>
      <footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2023-2024
        <i class="ri-heart-fill heart_icon"></i> Wang Wei
      </li>
    </ul>
    <ul>
      <li>
        
      </li>
    </ul>
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>Visitors:<span id="busuanzi_value_site_uv"></span></span>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>Views:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
      </li>
    </ul>
  </div>
</footer>    
    </main>
    <div class="float_btns">
      <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

    </div>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ww.ico" alt="朝花夕拾"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/js/jquery-3.6.0.min.js"></script>
 
<script src="/js/lazyload.min.js"></script>

<!-- Tocbot -->
 
<script src="/js/tocbot.min.js"></script>

<script>
  tocbot.init({
    tocSelector: ".tocbot",
    contentSelector: ".article-entry",
    headingSelector: "h1, h2, h3, h4, h5, h6",
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: "main",
    positionFixedSelector: ".tocbot",
    positionFixedClass: "is-position-fixed",
    fixedSidebarOffset: "auto",
  });
</script>

<script src="https://cdn.staticfile.org/jquery-modal/0.9.2/jquery.modal.min.js"></script>
<link
  rel="stylesheet"
  href="https://cdn.staticfile.org/jquery-modal/0.9.2/jquery.modal.min.css"
/>
<script src="https://cdn.staticfile.org/justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js"></script>

<script src="/dist/main.js"></script>

<!-- ImageViewer -->

<!-- MathJax -->

<!-- Katex -->

<!-- busuanzi  -->
 
<script src="/js/busuanzi-2.3.pure.min.js"></script>
 
<!-- ClickLove -->

<!-- ClickBoom1 -->

<!-- ClickBoom2 -->

<!-- CodeCopy -->
 
<link rel="stylesheet" href="/css/clipboard.css">
 <script src="https://cdn.staticfile.org/clipboard.js/2.0.10/clipboard.min.js"></script>
<script>
  function wait(callback, seconds) {
    var timelag = null;
    timelag = window.setTimeout(callback, seconds);
  }
  !function (e, t, a) {
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '<i class="ri-file-copy-2-line"></i><span>COPY</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      $(".article pre code").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });
      clipboard.on('success', function(e) {
        let $btn = $(e.trigger);
        $btn.addClass('copied');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-checkbox-circle-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPIED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-checkbox-circle-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
      clipboard.on('error', function(e) {
        e.clearSelection();
        let $btn = $(e.trigger);
        $btn.addClass('copy-failed');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-time-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPY FAILED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-time-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
    }
    initCopyCode();
  }(window, document);
</script>
 
<!-- CanvasBackground -->

<script>
  if (window.mermaid) {
    mermaid.initialize({ theme: "forest" });
  }
</script>


    
    

  </div>
</body>

</html>